import { Button, Input, Popconfirm, Switch, Checkbox, Card, message } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import type { ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import { 
  getCategoryListByPage,
  getBrandListByPage,
  getGoodsList, 
  doCreateGoods, 
  deleteGoods, 
  updateGoods, 
  updateGoodsStauts 
} from '@/services/stockGoods/api';
import { OptType } from '@/utils/constants';
import { ProFormFieldSet } from '@ant-design/pro-form';
import BreadcrumbDept from '@/components/BreadcrumbDept';

const StockList: React.FC = () => {

  const columns: ProColumns<STOCKGOODSAPI.GoodsItem>[] = [
    {
      title: '统计周期',
      dataIndex: 'goods_id',
      valueType: 'dateRange',
      hideInTable: true
    },
    {
      title: '商品编号',
      width: 250,
      dataIndex: 'goods_id'
    },
    {
      title: '商品名称',
      width: 300,
      dataIndex: 'goods_name'
    },
    {
      title: '商品规格',
      dataIndex: '',
      width: 250,
      search: false
    },
    {
      title: '异动时间',
      dataIndex: '',
      width: 200,
      search: false
    },
    {
      title: '初始记录',
      search: false,
      children: [
        {
          title: '进货价',
          dataIndex: '',
          width: 200
        },
        {
          title: '进货折扣',
          dataIndex: '',
          width: 250
        },
        {
          title: '实际进货价',
          dataIndex: '',
          width: 250
        },
        {
          title: '初始数量',
          dataIndex: '',
          width: 250
        }
      ]
    },
    
    {
      title: '异动情况',
      search: false,
      children: [
        {
          title: '进货价',
          dataIndex: '',
          width: 200
        },
        {
          title: '进货折扣',
          dataIndex: '',
          width: 250
        },
        {
          title: '实际进货价',
          dataIndex: '',
          width: 250
        },
        {
          title: '异动数量',
          dataIndex: '',
          width: 250
        }
      ]
    },
    {
      title: '调整后数量',
      dataIndex: '',
      search: false,
      width: 300
    },

    {
      title: '操作人',
      dataIndex: '',
      search: false,
      width: 250
    },
    {
      title: '操作人工号',
      dataIndex: '',
      search: false,
      width: 250
    }
  ];


  return (
    <PageContainer extra={[
      <BreadcrumbDept />
     ]} breadcrumb={{}}>
      <ProTable<STOCKGOODSAPI.GoodsItem, STOCKGOODSAPI.GoodsItem & COMMON.PageParams>
        rowKey="goods_id"
        bordered
        search={{
          defaultCollapsed: false,
          collapseRender: () => { return ''},
          optionRender: (searchConfig, formProps, dom) => {
            dom.shift();
            return [
              ...dom,
              <Button key="export" type="primary">导出报表</Button>
            ]
          }
        }}
        request={async (params) => {
          return {
            data: [],
            success: true,
            total: 0
          };
        }}
       
        columns={columns}
        scroll={{ x : 1000 }}
      />
    </PageContainer>
  );
};
export default StockList;
